package com.imooc.exception;

public class BusinessException extends RuntimeException{
    private String code;
    private String msg;
    public BusinessException(BusinessExceptionCode businessExceptionCode) {
        super(businessExceptionCode.toString());
        this.code = businessExceptionCode.getCode();
        this.msg = businessExceptionCode.getMessage();
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "BusinessException{" +
                "code='" + code + '\'' +
                ", msg='" + msg + '\'' +
                "} " + super.toString();
    }
}
